<template>
	<view class="" @click="visible=false">
		<action-bar type="back" :screen="isFullScreen" title="预约会议"></action-bar>
		<image class="height100vh image posiab top0" src="/static/img/changko.png"></image>
		<view class="posire zindex5 pt25px">
			<view class="bgfff mg30 ra20 hhf" :style="{height:win_height+'px'}">
				<view class="pg30-50">
					<view class="flex-a-i">
						<text class="colorFC474C">*</text>会议主题：
						<el-input v-model="mr_name" maxlength="30" style="width:40vw;" class="height80 "></el-input>
					</view>
					<view class="flex-a-i mt50">
						<text class="colorFC474C">*</text>开始时间：
							
						<el-date-picker :disabled-date="disabledDate" v-model="start_time" @change="datepicker"
							format="YYYY/MM/DD" type="date" placeholder="" />

						<view class="ml50 posire zindex50">
							<view class="height33px flex-a-i posiab ml10">
								<image mode="widthFix" class="width40 " src="/static/img/shizong.png"></image>
							</view>
							
							<view class="posire">
								<el-input  @click.stop="visible=true" tabindex="50" v-model="start_miao" input-style="padding-left:20px;" style="width: 240px;" />
								<image class="width40 posiab mt12 left10" mode="widthFix" src="/static/img/timeb.png"></image>
								<view @click.stop="return" class="bgfff posiab  ml80 mt20 " style="box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.10);" v-if="visible" >
									<picker-view style="width: 150px" :indicator-style="indicatorStyle" :value="pickerVlaue" @change="bindChange" class="picker-view ">
										<picker-view-column>
											<view class="item" v-for="(item,index) in times" :key="index">{{index>9?item:'0'+item}}</view>
										</picker-view-column>
										<picker-view-column>
											<view class="item" v-for="(item,index) in minutes" :key="index">{{index>9?item:'0'+item}}</view>
										</picker-view-column>
									</picker-view>
									<view class="flex-ju-a border-tdcdfe6 width300">
										<view class="flex-a-i ">
											<view @click.stop="visible=false" class="wh100-80  flex-ju-c ">取消</view>
											<view @click.stop="timepicker" class="wh100-80 colorfff flex-ju-c color165FFF ml20 ">确定</view>
										</view>
									</view>
								</view>
							</view>
							<!-- 
							<uni-data-select number="25" v-model="start_miao" :clear="false" style="width: 240px"
								:localdata="range" @change="timepicker"></uni-data-select> -->
						</view>
					</view>
					<view v-if="meeting_select_default!=33" class="flex-a-i mt50">
						<text class="colorFC474C">*</text>会议时长：
						<el-input-number @change="numbertime" :max="48" v-model="time_hour" :min="0" controls-position="right"
							style="width:200rpx;height:80rpx;" class=" mr20" />小时
						<el-input-number @change="numbertimefen" v-model="time_minute" :min="0"
							controls-position="right" style="width:200rpx;height:80rpx;" class="ml50 mr20" />
						分钟
					</view>

					<view class="flex mt50">
						<view class="mt20">
							<text class="colorFC474C">*</text>重复会议：
						</view>

						<view class="size28">

							<uni-data-select v-model="meeting_select_default" :clear="false"
								style="width: 240px;margin-top:8px;" :localdata="select_meeting_type"
								@change="huiyisvaluechange"></uni-data-select>

							<template v-if="meeting_select_default==22">
								<view class="flex-a-i size24 mt30 mb30">
									<view @click="onCycle(item,inbdex)"
										:class="item.tindex == 1 ? 'bg165FFF' :'borderf4f6f8'"
										class="wh100-70 flex-ju-c colorfff  mr20" v-for="(item,inbdex) in Calendar"
										:key="inbdex">{{item.text}}</view>
								</view>

								<text class="colorFC474C">*</text>截至日期：<el-date-picker :disabled-date="disabledDate"
									v-model="weekly_end_time" @change="enddatepicker" format="YYYY/MM/DD" type="date"
									placeholder="" />
								<text class=" ml30">共{{activities.length}}场</text><text @click="$refs.uphuiyi.open()"
									class="color165FFF ml30">查看</text>
							</template>


						</view>

					</view>


					<view class="flex-a-i mt50 border-tebecef pt50">
						参会人员：
						<view class="borderE6EBF0 flex-a-i flex-wrap  size28  color31373D">
							<view class="posire " id="idheight">
								<!-- <view class="bgred wh2100-80 posiab opct00"></view> -->
								<view class="posiab width80 right0 flex-ju-c " :style="{height:height}">
									<view @click="canhuirenyuan" class="posiab border-le6ebf0 pl20 right20  ">
										<image mode="widthFix" class="width50 image" src="/static/img/tianjia.png"></image>
									</view>
								</view>
								

								<el-select v-model="select_value" @remove-tag="value_clear" multiple
									style="width:46rem;" size="large" placeholder="" popper-class="popperclass">
									<template #label="{ label, value }">
										<view class="flex-a-i">
											<span>
												<image mode="widthFix" class="width50 image"
													src="/static/img/xaing.png"></image>
											</span>
											<span
												style="font-weight: bold">{{ value.name?value.name:value.departmentName }}</span>
										</view>
									</template>
									
								</el-select>

							</view>

						</view>
					</view>

					<view class="flex-a-i mt50" style="width: 540px;">
						<text class="colorFC474C">*</text>云会议室：

						<uni-mi-select v-model="room_id" :clear="false" :localdata="cities"
							@change="select_change"></uni-mi-select>

					</view>

					<view class="flex-a-i mt50">
						<text class="colorFC474C">*</text>主持密码：
						<el-input placeholder="" maxlength="10" minlength="4" show-password v-model="ctrl_pwd" style="width:400rpx;height:80rpx;"
							class=" mr50"></el-input>

						参会密码：<el-input placeholder="" show-password v-model="join_pwd"
							style="width:400rpx;height:80rpx;"></el-input>
					</view>

					<view class="flex-a-i mt50">
						会议设置：<el-checkbox v-model="auto_invite" label="会议开始时自动呼叫参会人    " size="large" />
					</view>
					<view class="flex-a-i mt50 width1650">
						会议详情：
						<el-input v-model="extra" maxlength="300" show-word-limit :rows="5" class="flex1"
							type="textarea" placeholder="输入会议详情" />
					</view>
					<view class="shwo height10 mt50"></view>
					<view class="flex-ju-c mt80">
						<view @click="back()" class="wh300-80 border165FFF color165FFF flex-ju-c ra5">取消</view>
						<view @click="create_meeting"
							class="wh300-80 colorfff flex-ju-c border165FFF bg165FFF ml60 ra5">
							{{schedule_id>0?'修改':'提交'}}
						</view>
					</view>
				</view>
			</view>
		</view>

		<uni-popup ref="uphuiyi" mode="center">
			<view class="bgfff wh1100-1000 ra20">
				<image @click="$refs.uphuiyi.close()" mode="widthFix" class="image posiab right30 top20 width50"
					src="/static/img/bi.png"></image>
				<view class="size36 color333 bold flex-a-i pl50 pb30 pt30 mb60 border-bebecef">
					<view class="wh6-30 mt8 bg2C7BFF mr15"></view>所有周期会议
				</view>
				<scroll-view class="height800 scroll-view text-left" scroll-y>
					<el-timeline style="max-width: 600px;padding-left:170rpx;">
						<el-timeline-item v-for="(activity, index) in activities" :key="index" :icon="activity.icon"
							:type="activity.type" :size="activity.size"
							:hollow="activity.hollow" :timestamp="activity.timestamp">
							<view class="posiab color165FFF bold left-110">第{{index+1}}场</view>
							<view class="bold color000" >
								{{ activity.content==1?'周一':activity.content==2?'周二':activity.content==3?'周三':activity.content==4?'周四':activity.content==5?'周五':activity.content==6?'周六':'周日' }}
							</view>
						</el-timeline-item>
					</el-timeline>
				</scroll-view>

			</view>
		</uni-popup>
		
		
		<invite-communication :motting="mottinglist" :defaultMO="defaultMonitor" :defaultME="defaultMeeting" @mottingData="mottingData" type="1" ref="upInvite"></invite-communication>
		
		
		
		<tishi ref="showtishi" isclen="1" bgcolor="#fc474c" title="您确定要退出登录吗？"></tishi>
		<tishi ref="upLogOut" @confirm="onLogOut" logout="1" bgcolor="#fc474c" title="当前账号在其他设备登录？"></tishi>
	</view>
</template>

<script>
	import {
		ElMessage
	} from 'element-plus'
	function generateTimeSeries() {
		const times = [];
		let time = new Date();
		time.setHours(0, 0, 0, 0);
		while (time.getHours() < 23 || (time.getHours() === 23 && time.getMinutes() < 30)) {
			const formattedTime =
				`${String(time.getHours()).padStart(2, '0')}:${String(time.getMinutes()).padStart(2, '0')}`;
			times.push({
				value: formattedTime,
				label: formattedTime
			});
			time.setMinutes(time.getMinutes() + 30); // 增加30分钟
		}

		return times;
	}

	export default {
		data() {
			var times=[]
			var minutes=[]
			for (let i = 0; i <= 23; i++) {
			                times.push(i)
			}
			for (let i = 0; i <= 59; i++) {
				minutes.push(i)
			}
			return {
				height:"",
				isFullScreen:true,
				times,
				minutes,
				visible: false,
				indicatorStyle: `height: 50px;`,
				pickerVlaue:[0,0],
				
				
				cycleData: [],
				weekly_all_sessions: [],
				weekly_end_time: "",
				thatjoin_pwd: "",
				thatctrl_pwd: "",
				defaultMeeting:[],
				defaultMonitor:[],
				monitorLIST: [],
				start_miao: '00:00',
				range: generateTimeSeries(),
				mr_name: uni.getStorageSync('user').user.nickName + '的会议',
				ctrl_pwd: "", //主持密码
				join_pwd: "", //加入密码， 
				start_dtm: "",
				start_time: new Date(),
				weekly_end_dtm: "",
				start_data_time: "",
				duration: 7200,
				time_hour: 2,
				time_minute: 0,
				mottinglist:[],
				select_meeting_type: [{
						value: "11",
						label: '不重复'
					},
					{
						value: "22",
						label: '周期会议'
					},
					{
						value: "33",
						label: '永久会议'
					},
				],
				meeting_select_default: "11",
				Calendar: [{
						tindex: 0,
						text: "周一"
					},
					{
						tindex: 0,
						text: "周二"
					},
					{
						tindex: 0,
						text: "周三"
					},
					{
						tindex: 0,
						text: "周四"
					},
					{
						tindex: 0,
						text: "周五"
					},
					{
						tindex: 0,
						text: "周六"
					},
					{
						tindex: 0,
						text: "周日"
					}
				],
				invite_usr_ids: [],
				meeting_list: [],
				monitor_list: [],
				select_value: [],
				cities: [],
				calldata: {},
				auto_invite: true,
				extra: "",
				room_id: '',
				weekly_period: '0',
				schedule_id: "",
				timeout: "",
				activeName: "first",
				activities: [],
				win_height: "",
				max_call:"",
				newTimer:"",
			}
		},
		onShow() {
			
			
			this.isFullScreen=!this.isFullScreen
			
			uni.$off('onLogOut')
			uni.$on('onLogOut', res => {
				this.$refs.upLogOut.show()
			})
			if (flutter) {
				flutter.call('setActionBar', {
					type: 'back',
					title: "预约会议",
					isWhite: false,
					onDownloads: "",
					onSettings: '',
					onBack: 'handleBack()',
					onClose: 'handleClickclose()'
				}, (result, error) => {})
			}
			
			window.handleBack = () => {
				this.back()
			}
			window.handleClickclose = () => {
				uni.$emit('exitclose')
				this.$refs.showtishi.show()
			}
		},
		onReady() {
			uni.onWindowResize((res) => {
				this.win_height = res.size.windowHeight - 60
			});
		},
		onLoad(option) {
			this.schedule_id = option.schedule_id
		},
		mounted() {
			
			
			this.win_height = this.wheight - 60
			uni.showLoading()
			let mt=Math.floor(new Date().getTime() / 1000)
			this.start_data_time = 	this.timeTamp(mt, 'day')
			
			this.getSecond()
			this.getHours()

			setTimeout(() => {
				loginMgr.get_self_room_info().then(res => {
					this.cities.push({
						label: res.room_name + ' (' + res.cuid + ')',
						value: res.room_id,
						id: '容量：' + res.max_call
					})
					this.max_call=res.max_call
					this.room_id = res.room_id
					this.ctrl_pwd = this.thatctrl_pwd = res.ctrl_pwd
					this.join_pwd = this.thatjoin_pwd = res.join_pwd
				})


				loginMgr.get_public_rooms({
					cmdid: 'search_room',
					filter_type: ['disable', 'is_used'],
					filter_value: [0, 1],
				}).then(res => {
					uni.hideLoading()
					for (var i = 0; i < res.length; i++) {
						this.cities.push({
							label: res[i].room_name + ' (' + res[i].cuid + ')',
							value: res[i].room_id,
							id: '容量：' + res[i].max_call
						})
					}
					if (this.schedule_id > 0) {
						this.getlist()
					}else{
						let sdkinfo = uni.getStorageSync('sdkinfo')
						this.select_value.push({
							id:sdkinfo.id,
							name:sdkinfo.trueName
						})
					}
				})
			}, 1000)
			 
			 this.getVideoW('#idheight').then(res=>{
			 	this.height=res+'px'
			 })
		},
		methods: {
			getVideoW(id) {
				return new Promise((resolve, reject) => {
					const query = uni.createSelectorQuery().in(this);
					query.select(id).boundingClientRect((data) => {
						if (data) {
							resolve(data.height)
						}
					}).exec();
				})
			},
			getSecond(){
				let now = new Date();
				let nowInMilliseconds = now.getTime();
				let thirtyMinutesInMilliseconds = 30 * 60 * 1000;
				// 计算30分钟后的时间（毫秒）
				let thirtyMinutesLaterInMilliseconds = nowInMilliseconds + thirtyMinutesInMilliseconds;
				// 将30分钟后的时间转换为秒
				this.start_dtm = Math.floor(thirtyMinutesLaterInMilliseconds / 1000);
			},
			getHours(){
				let now = new Date();
				now.setMinutes(now.getMinutes() + 30);
				let hours = now.getHours();
				let minutes = now.getMinutes();
				let hour= hours>9?hours:'0'+hours
				let minute= minutes>9?minutes:'0'+minutes
				this.start_miao = hour+':'+minute
				this.pickerVlaue=[hour,minute]
			},
			 bindChange(e) {
				const val = e.detail.value
				var val1=val[0]>9?val[0]:('0'+ val[0])
				var val2=val[1]>9?val[1]:('0'+ val[1])
				this.start_miao= val1+':'+val2
				
			},
			timepicker(e) {
				this.visible=false
				var endtime = this.start_data_time + this.start_miao
				this.start_dtm = new Date(endtime).getTime() / 1000
				
				if (this.start_dtm && this.weekly_end_dtm && this.cycleData.length && this.meeting_select_default == 22) {
					this.countWeek(this.start_dtm * 1000, this.weekly_end_dtm * 1000, this.cycleData);
				}
			},
			
			disabledDate(time) {
				return time.getTime() < Date.now() - 86400000;
			},
			countWeek(startDate, endDate, daysOfWeekArray) {
				const end = new Date(endDate);
				const currentDate = new Date(startDate);
				const countMap = {};
				daysOfWeekArray.forEach(day => {
					countMap[day] = 0;
				});

				let current = new Date(currentDate);
				this.activities = []
				// 循环遍历日期，直到达到或超过截止日期
				while (current < end) {
					const dayOfWeek = current.getDay();
					if (countMap.hasOwnProperty(dayOfWeek)) {
						countMap[dayOfWeek]++;
						this.activities.push({
							type: 'primary',
							hollow: true,
							content: new Date(current.getTime()).getDay(),
							timestamp: this.timeTamp(this.start_dtm) + ' —— ' + this.timeTamp(this.start_dtm + this
								.duration)
						})
					}
					current.setDate(current.getDate() + 1);
				}
			},
			tabClick(e) {
				if (this.monitorLIST.length) {

					return
				}
				if (e == 'second') {
					uni.showLoading()
					this.http('/v1/organization/tree/list').then(res => {
						uni.hideLoading()
						this.monitorLIST = res.data
					})
				}
			},
			select_change(e) {
				if (e == uni.getStorageSync('info').priv_room_id) {
					this.ctrl_pwd = this.thatctrl_pwd
					this.join_pwd = this.thatjoin_pwd
				} else {
					this.ctrl_pwd = ''
					this.join_pwd = ''
				}
				this.room_id = e
			},
			getlist() {
				this.ghttp('/schedules/schedule_ids/', {
					cmdid: "subscribe_schedule",
					schedule_ids: [+this.schedule_id]
				}, 'post').then(res => {
					res.weekly_all_sessions[0].map(item => {
						this.activities.push({
							type: 'primary',
							hollow: true,
							content: new Date(item[0] * 1000).getDay(),
							timestamp: this.timeTamp(item[0]) + '——' + this.timeTamp(item[1])
						})
					})
					this.mr_name = res.mr_names[0]
					this.start_time = res.start_dtms[0] * 1000
					this.weekly_end_dtm = res.weekly_end_dtm[0]
					this.weekly_end_time = res.weekly_end_dtm[0] * 1000
					this.start_data_time = res.start_dtms[0]
					if (res.weekly_periods[0] == 0) {
						this.meeting_select_default = '11'
					} else if (res.weekly_periods[0] == 1111111) {
						this.meeting_select_default = '33'
					} else {
						this.meeting_select_default = '22'
					}
					if (res.weekly_periods[0].length <= 7) {
						var str = '000000' + res.weekly_periods[0]
					}
					var newlen = str.slice(-7)
					this.weekly_period = newlen
					var reverseString = newlen.split('').reverse().join('');
					for (var i = 0; i < reverseString.length; i++) {
						if(reverseString[i]==1){
							if(i==6){
								this.cycleData.push(0)
							}else{
								this.cycleData.push(i+1)
							}
						}
						this.Calendar[i].tindex = reverseString[i]
					}
					this.duration = res.durations[0] //会议时长
					this.room_id = res.room_ids[0]
					this.start_miao = this.timeTamp(res.start_dtms[0], 'hours')
					this.time_hour = Math.floor(res.durations[0] / 3600)
					this.time_minute = Math.floor((res.durations[0] % 3600) / 60)
					this.join_pwd = res.join_pwds[0]
					this.ctrl_pwd = res.ctrl_pwds[0]
					this.auto_invite = res.auto_invites[0] == 1 ? true : false
					this.extra = res.extras[0]
					this.start_dtm = res.start_dtms[0]
					this.start_data_time = this.timeTamp(res.start_dtms[0], 'day')
					this.invite_usr_ids = res.invite_usr_ids[0]
					res.invite_usr_ids[0].map((item, index) => {
						this.select_value.push({
							id: item,
							name: res.invite_usr_nick_names[index]
						})
					})


				})
			},
			onCycle(item, indx) {
				
				let cycle = indx + 1
				if (cycle == 7) {
					cycle = 0
				}
				this.cycleData.push(cycle)
				
				if (item.tindex == 1) {
					item.tindex = 0
					this.cycleData = this.remove(this.cycleData)
				} else {
					item.tindex = 1
				}
				 
				
				
				let arr = []
				this.Calendar.map(item => {
					arr.push(item.tindex)
				})
				this.weekly_period = arr.reverse().join('')

				if (this.start_dtm && this.weekly_end_dtm && this.cycleData.length && this.meeting_select_default == 22) {
					this.countWeek(this.start_dtm * 1000, this.weekly_end_dtm * 1000, this.cycleData);
				}else{
					this.activities=[]
				}
			},
			value_clear(e) {
				if (e.id) {
					this.select_value.map((item, index) => {
						if (item.id == e.id) {
							this.select_value.splice(index, 1)
						}
					})
				} else {
					this.select_value.map((item, index) => {
						if (item.userId == e.userId) {
							this.select_value.splice(index, 1)
						}
					})
				}


			},
		
			mottingData(data){
				if(data.length > this.max_call){
					ElMessage({
						message: '超出云会议室容量 '+ this.max_call,
						type: 'warning',
					})
					return
				}
				
				this.select_value = data
				setTimeout(()=>{
					this.getVideoW('#idheight').then(res=>{
						this.height=res+'px'
						this.$refs.upInvite.close()
					})
				},300)
				
				
			
				
			},
			canhuirenyuan() {
					if (this.select_value.length) {
						this.mottinglist = this.select_value
						this.defaultMeeting=[]
						this.select_value.map(item => {
							this.defaultMeeting.push(item.id?item.id:item.userId)
						})
					}
				this.$refs.upInvite.open()
				
				// uni.showLoading()
				// this.http('/v1/organization/meeting/tree/list').then(res => {
				// 	uni.hideLoading()
				// 	var data = [res.data]
				// 	this.traverseTree(data)
				// 	this.tabdatapane = data
				// 	this.$refs.upInvite.open(1)
				// })
			
			
			},
			
			numbertimefen(e) {
				this.duration = e * 60 + this.time_hour * 3600

				if (this.start_dtm && this.weekly_end_dtm && this.cycleData.length && this.meeting_select_default == 22) {
					this.countWeek(this.start_dtm * 1000, this.weekly_end_dtm * 1000, this.cycleData);
				}
			},
			numbertime(e) {
				this.duration = e * 3600 + this.time_minute * 60

				if (this.start_dtm && this.weekly_end_dtm && this.cycleData.length && this.meeting_select_default == 22) {
					this.countWeek(this.start_dtm * 1000, this.weekly_end_dtm * 1000, this.cycleData);
				}
			},
			datepicker(e) {
				this.start_data_time = this.timeTamp(e, 'day')
				var endtime = this.start_data_time + this.start_miao
				this.start_dtm = new Date(endtime).getTime() / 1000

				if (this.start_dtm && this.weekly_end_dtm && this.cycleData.length && this.meeting_select_default == 22) {
					this.countWeek(this.start_dtm * 1000, this.weekly_end_dtm * 1000, this.cycleData);
				}
			},
			enddatepicker(e) {
				let enddatetian = this.timeTamp(e, 'day')
				this.weekly_end_dtm = new Date(enddatetian).getTime() / 1000

				if (this.start_dtm && this.weekly_end_dtm && this.cycleData.length && this.meeting_select_default == 22) {
					this.countWeek(this.start_dtm * 1000, this.weekly_end_dtm * 1000, this.cycleData);
				}
			},
			remove(arr) {
				const countMap = new Map();
				arr.forEach(item => countMap.set(item, (countMap.get(item) || 0) + 1));
				return arr.filter(item => countMap.get(item) === 1);
			},
			

			
			isNumeric(str) {
				return /^\d+$/.test(str);
			},
			//提交预约
			create_meeting() {

				if (this.mr_name == '') {
					ElMessage({
						message: '会议主题空',
						type: 'warning',
					})
					return
				}
				if (this.start_dtm == '') {
					ElMessage({
						message: '选择开始时间',
						type: 'warning',
					})
					return
				}
				if (this.meeting_select_default != 33) {
					if (this.duration == '') {
						ElMessage({
							message: '输入会议时长',
							type: 'warning',
						})
						return
					}
				}



				if (this.room_id == '') {
					ElMessage({
						message: '选择云会议室',
						type: 'warning',
					})
					return
				}
					
					if (this.ctrl_pwd.length<4) {
						ElMessage({
							message: '主持密码最少4位数',
							type: 'warning',
						})
						return
					}
					if (this.join_pwd&&this.join_pwd.length<4) {
						ElMessage({
							message: '参会密码最少4位数',
							type: 'warning',
						})
						return
					}

				if (this.ctrl_pwd == '') {
					ElMessage({
						message: '主持密码空',
						type: 'warning',
					})
					return
				}
				if (this.ctrl_pwd == this.join_pwd) {
					ElMessage({
						message: '参会密码与主持密码不能相同',
						type: 'warning',
					})
					return
				}


				if (this.ctrl_pwd.length < 4) {
					ElMessage({
						message: '密码太短',
						type: 'warning',
					})
					return
				}

				if (!this.isNumeric(this.ctrl_pwd)) {
					ElMessage({
						message: '密码只能为数字',
						type: 'warning',
					})
					return
				}
				if (this.join_pwd && !this.isNumeric(this.join_pwd)) {
					ElMessage({
						message: '密码只能为数字',
						type: 'warning',
					})
					return
				}
				
				this.invite_usr_ids = []
				this.select_value.map(item => {
					if (item.id) {
						this.invite_usr_ids.push(+item.id)
					} else {
						this.invite_usr_ids.push(+item.userId)
					}
				})

				var ceobj = {
					room_id: this.room_id,
					mr_name: this.mr_name,
					join_pwd: this.join_pwd,
					ctrl_pwd: this.ctrl_pwd,
					start_dtm: this.start_dtm,
					extra: this.extra,
					auto_invite: this.auto_invite ? 1 : 0,
					invite_usr_ids: this.invite_usr_ids
				}



				if (this.meeting_select_default == 11) {
					ceobj.weekly_period = '0'
					ceobj.duration = this.duration
				} else if (this.meeting_select_default == 33) {
					ceobj.weekly_period = '1111111'
				} else {
					ceobj.weekly_period = this.weekly_period
					ceobj.weekly_end_dtm = this.weekly_end_dtm
					ceobj.duration = this.duration
					if (this.weekly_period == 1111111) {
						uni.showToast({
							title: "重复会议不能全选",
							icon: "none"
						})
						return
					}
					if (this.weekly_period == 0) {
						uni.showToast({
							title: "请选择会议周期",
							icon: "none"
						})
						return
					}
					if (!this.weekly_end_dtm) {
						uni.showToast({
							title: "请选择截至日期",
							icon: "none"
						})
						return
					}
				}


				
				if(this.invite_usr_ids.length > this.max_call){
					uni.showToast({
						title: "超出云会议室的最大呼叫数 "+this.max_call,
						icon: "none"
					})
					return
				}

				uni.showLoading()
				if (this.schedule_id > 0) {

					loginMgr.mod_schedule(+this.schedule_id, ceobj).then(res => {
						uni.hideLoading()
						if (res.result == 0) {
							ElMessage({
								message: '修改会议成功',
								type: 'success',
							})
							setTimeout(() => {
								this.back()
							}, 700)
						} else {
							ElMessage({
								message: res.reason,
								type: 'error',
							})
						}
					})
				} else {
					loginMgr.add_schedule(ceobj).then(res => {
						uni.hideLoading()
						if (res.result == 0) {
							ElMessage({
								message: '创建会议成功',
								type: 'success',
							})
							setTimeout(() => {
								this.back()
							}, 700)
						} else {
							if(res.code == 7001){
								ElMessage({
									message:'预约会议时间冲突！',
									type: 'error',
								})
								uni.showToast({
									title:"预约会议时间冲突!",
									icon:"none"
								})
							}else if(res.code == 5085){
								ElMessage({
									message:'资源数超限！',
									type: 'error',
								})
								uni.showToast({
									title:"资源数超限!",
									icon:"none"
								})
							}else if(res.code == 7002){
								ElMessage({
									message:'预约时间要比当前超过10分钟',
									type: 'error',
								})
								uni.showToast({
									title:"预约时间要比当前超过10分钟",
									icon:"none"
								})
							}else if(res.code == 7099){
								ElMessage({
									message:'无法在截止日期内参加会议',
									type: 'error',
								})
							}else{
								ElMessage({
									message: res.reason,
									type: 'error',
								})
							}
							
						}
					})
				}

				if (this.room_id == uni.getStorageSync('info').priv_room_id) {
					loginMgr.mod_self_room_info({
						join_pwd: this.join_pwd,
						ctrl_pwd: this.ctrl_pwd
					}).then(res => {

					})
				}

			},
			 
			

			huiyisvaluechange(e) {
				this.meeting_select_default = e
			}
		}
	}
</script>

<style>
	/deep/ .el-tree-node__content {
		height: 50px;
		/* 设置你想要的节点高度 */
	}
	/deep/ .el-timeline-item__tail{
		border-left: 2px solid #165FFF;
	}

	/deep/ .el-tree-node__expand-icon {
		color: #165DFF;
	}
	
	/deep/ .el-timeline-item__node--primary{
		border-color:#165FFF;
	}
	/deep/ .el-timeline-item__timestamp{
		color:#333;
	}

	.shwo {
		background: linear-gradient(#ebecef, #f9f9f9);
	}

	.hhf {
		overflow: auto;
	}

	.borderf4f6f8 {
		color: #333333;
		border: 1px solid #f4f6f8;
	}

	/deep/ .popperclass {
		display: none;
	}
	
	
	.picker-view {
			width: 750rpx;
			height: 600rpx;
			margin-top: 20rpx;
		}
		.item {
			line-height: 100rpx;
			text-align: center;
		}
</style>